//
//  Coupon.m
//  OrgOnline
//
//  Created by kiko on 16/3/2.
//  Copyright © 2016年 kiko. All rights reserved.
//
#import "CouponAdd.h"
#import "PurpleButton.h"
#import "Coupon.h"

@interface Coupon (){
    NSArray *couponList;

}

@end

@implementation Coupon

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationController.navigationBarHidden = NO;
    self.view.backgroundColor=[UIColor colorWithRed:241.0f/255.0f green:242.0f/255.0f blue:247.0f/255.0f alpha:1];
    // Do any additional setup after loading the view.
   // [self configHeadView];
    self.title = @"优惠券";
    [self viewDidLoadBlue];
    [self configHeadRight];
    [self configContent];
    
}

-(void)configHeadRight{
    
    
    UIButton *rbut = [[UIButton alloc] initWithFrame:CGRectMake(swidth-65, 11, 22, 22)];
    
    UIImageView *img=[[UIImageView alloc] initWithFrame:CGRectMake(0, 0 ,22,22)];
    img.image=[UIImage imageNamed:@"couponadd"];
    [rbut addSubview:img];
    
    [rbut addTarget:self action:@selector(couponAdd) forControlEvents:UIControlEventTouchUpInside];
    
    UIBarButtonItem *rightbtn = [[UIBarButtonItem alloc] initWithCustomView:rbut];
    self.navigationItem.rightBarButtonItem = rightbtn;
    
    
    
}
- (void)couponAdd{
    CouponAdd * view = [[CouponAdd alloc]init];
    [view setHidesBottomBarWhenPushed:YES];
    [self.navigationController pushViewController:view animated:YES];
}





-(void)configContent{
    if(couponList==nil){
        UIImageView *couponImg=[[UIImageView alloc] initWithFrame:CGRectMake((swidth-80)/2,114.5, 80, 70)];
        couponImg.image=[UIImage imageNamed:@"coupon"];
        [self.view addSubview:couponImg];
        
        UILabel *nilMsg=[[UILabel alloc] initWithFrame:CGRectMake(0,213.5, swidth, 40)];
        nilMsg.text=@"目前还没有优惠券，赶紧添加优惠券吧";
        nilMsg.textColor=[UIColor colorWithRed:153.0f/255.0f green:153.0f/255.0f blue:153.0f/255.0f alpha:1];
        nilMsg.textAlignment= NSTextAlignmentCenter;
        
        [self.view addSubview:nilMsg];
        
        PurpleButton *addbut=[PurpleButton buttonWithType:UIButtonTypeCustom];
        addbut.frame = CGRectMake((swidth-123)/2, 288.5, 123, 34);
        [addbut setTitle:@"添加优惠券" forState:UIControlStateNormal];
        [addbut.titleLabel setFont:[UIFont boldSystemFontOfSize:14]];
        [addbut addTarget:self action:@selector(couponAdd) forControlEvents:UIControlEventTouchUpInside];
        [self.view addSubview:addbut];
    }
    else{
        
    }
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
